<html>
<head><meta charset="utf-8"><title>Turn off one optimization pass when compiling stage0 compile · t-compiler/help · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/index.html">t-compiler/help</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Turn.20off.20one.20optimization.20pass.20when.20compiling.20stage0.20compile.html">Turn off one optimization pass when compiling stage0 compile</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="240689535"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Turn%20off%20one%20optimization%20pass%20when%20compiling%20stage0%20compile/near/240689535" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> alicia <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Turn.20off.20one.20optimization.20pass.20when.20compiling.20stage0.20compile.html#240689535">(May 29 2021 at 07:40)</a>:</h4>
<p>I am working on static analysis by adding an MirPass. My MirPass could take a long time, so I want to turn off this pass when compiling stage1 compiler. How can I do it?</p>



<a name="240699134"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Turn%20off%20one%20optimization%20pass%20when%20compiling%20stage0%20compile/near/240699134" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Turn.20off.20one.20optimization.20pass.20when.20compiling.20stage0.20compile.html#240699134">(May 29 2021 at 12:13)</a>:</h4>
<p><span class="user-mention" data-user-id="384150">@alicia</span> why do you need to build stage 2 in the first place? (I assume that's what you mean, stage1 is built using the beta compiler which doesn't have your pass)</p>



<a name="240712106"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Turn%20off%20one%20optimization%20pass%20when%20compiling%20stage0%20compile/near/240712106" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> alicia <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Turn.20off.20one.20optimization.20pass.20when.20compiling.20stage0.20compile.html#240712106">(May 29 2021 at 17:28)</a>:</h4>
<p><span class="user-mention" data-user-id="232545">@Joshua Nelson</span> Sorry I mean compiling into stage1 using beta compiler. The doc says it will also build std using the stage1 compiler .Since stage1 has my pass., it turns out it stuck on my pass when compiling library/core so I wonder how can I turn it off.</p>



<a name="240712549"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Turn%20off%20one%20optimization%20pass%20when%20compiling%20stage0%20compile/near/240712549" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Turn.20off.20one.20optimization.20pass.20when.20compiling.20stage0.20compile.html#240712549">(May 29 2021 at 17:38)</a>:</h4>
<p><span class="user-mention" data-user-id="384150">@alicia</span> there's no easy way to do it - if it's that slow on core, maybe consider making it faster? or if you're still working on it, consider writing a <code>#![no_core]</code> test case so you don't have to build core in the first place</p>



<a name="240712644"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Turn%20off%20one%20optimization%20pass%20when%20compiling%20stage0%20compile/near/240712644" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> alicia <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Turn.20off.20one.20optimization.20pass.20when.20compiling.20stage0.20compile.html#240712644">(May 29 2021 at 17:41)</a>:</h4>
<p>Thanks! I will try to optimize my code</p>



<a name="240713255"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Turn%20off%20one%20optimization%20pass%20when%20compiling%20stage0%20compile/near/240713255" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tm <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Turn.20off.20one.20optimization.20pass.20when.20compiling.20stage0.20compile.html#240713255">(May 29 2021 at 17:55)</a>:</h4>
<p>Potential options:  1) enable it through a command line flag (e.g., <code>-Zmir-opt-level</code> if appropriate), 2) use <code>./x.py --keep-stage-std 1</code> to avoid rebuilding the standard library.</p>



<a name="240718167"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Turn%20off%20one%20optimization%20pass%20when%20compiling%20stage0%20compile/near/240718167" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> alicia <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Turn.20off.20one.20optimization.20pass.20when.20compiling.20stage0.20compile.html#240718167">(May 29 2021 at 19:50)</a>:</h4>
<p><span class="user-mention" data-user-id="352985">@tm</span> I used --keep-stage and that worked! Thank you</p>



<a name="240720029"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Turn%20off%20one%20optimization%20pass%20when%20compiling%20stage0%20compile/near/240720029" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Turn.20off.20one.20optimization.20pass.20when.20compiling.20stage0.20compile.html#240720029">(May 29 2021 at 20:40)</a>:</h4>
<p><span aria-label="+1" class="emoji emoji-1f44d" role="img" title="+1">:+1:</span> , <code>--keep-stage</code> and <code>--keep-stage-std</code> are life-savers.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>